<template>
  <div class="header-container">
    <div class="header-title">{{ title }}</div>
    <div class="header-time">{{ currentTime }}</div>
    <div class="header-right">
      <div class="header-icon">
        <span></span>
      </div>
      <div class="header-tq">多云</div>
      <div>17~28℃</div>
      <div>东南风3级</div>
    </div>
    <div class="header-image"></div>
    <img
      :src="require('@/assets/images/jdt.webp')"
      alt=""
      srcset=""
      class="header-jdt-left"
    />
    <img
      :src="require('@/assets/images/jdt.webp')"
      alt=""
      srcset=""
      class="header-jdt-right"
    />
  </div>
</template>

<script>
export default {
  name: "BscHeader",
  props: {
    title: {
      type: String,
      required: true,
      default: "默认标题",
    },
  },
  data() {
    return {
      currentTime: "",
    };
  },
  mounted() {
    this.updateTime();
    this.timer = setInterval(this.updateTime, 1000);
  },
  beforeDestroy() {
    if (this.timer) {
      clearInterval(this.timer);
    }
  },
  methods: {
    updateTime() {
      this.currentTime = this.$moment().format("YYYY年MM月DD日 HH:mm:ss");
    },
  },
};
</script>

<style scoped>
.header-container {
  width: 100%;
  height: 70px;
  position: relative;
  margin-top: 15px;
}
.header-title {
  position: absolute;
  top: -5px;
  height: 50px;
  font-family: SourceHanSansCN-Bold;
  font-size: 41px;
  font-weight: normal;
  color: rgb(237, 246, 255);
  text-align: center;
  width: 100%;
   text-shadow: rgb(0, 117, 255) 0px 0px 8px;
}

.header-time {
  position: absolute;
  top: 40px;
  left: 5%;
  font-family: SourceHanSansCN-Regular;
  font-size: 20px;
  color: rgb(237, 246, 255);
  text-align: center;
  white-space: nowrap;
  text-shadow: rgb(0, 117, 255) 0px 0px 8px;
}
.header-right {
  position: absolute;
  top: 0px;
  right: 0;
  /* font-family: SourceHanSansCN-Regular;
  font-size: 16px;
  color: rgb(237, 246, 255); */
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  display: flex;
  width: 18%;
  justify-content: space-around;
  font-size: 16px;
  color: rgb(5, 183, 242);
  font-family: SourceHanSansCN-Medium;
}
.header-icon {
  width: 50px;
  height: 50px;
  position: relative;
}
.header-icon span {
  mask: url(https://assets.easyv.cloud/components/static-image/weather/overcast-sun.png)
      0px 0px / 100% 100%,
    url(https://assets.easyv.cloud/components/static-image/weather/cloud.png)
      0px 0px / 100% 100%;
  background: linear-gradient(
    rgb(175, 225, 255) 0%,
    rgb(175, 225, 255) 60%,
    rgba(175, 225, 255, 0) 100%
  );
  position: absolute;
  width: 100%;
  height: 100%;
  top: -14px;
}
.header-tq {
  font-size: 16px;
  color: rgb(175, 225, 255);
  font-family: SourceHanSansCN-Medium;
}
.header-image {
  width: 100%;
  height: 100%;
  opacity: 1;
  transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scaleX(1) scaleY(1)
    translate3d(0px, 0px, 0px);
  mix-blend-mode: normal;
  pointer-events: auto;
  background: url("~@/assets/images/ht.png") left center / 100% 100% no-repeat;
}
.header-jdt-left {
  position: absolute;
  top: 13px;
  left: 179px;
  width: 69px;
  height: 17px;
  animation-duration: 5s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  mix-blend-mode: normal;
  pointer-events: auto;
  opacity: 1;
  transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scaleX(1) scaleY(1)
    translate(0px, 0px);
}
.header-jdt-right {
  position: absolute;
  top: 32px;
  right: 179px;
  width: 69px;
  height: 17px;
  animation-duration: 5s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  mix-blend-mode: normal;
  pointer-events: auto;
  opacity: 1;
  transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scaleX(1) scaleY(1)
    translate(0px, 0px);
}
</style>
